<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd"
    >
<html lang="en">
<head>
<title>Свободный чат для любителей свободного общения.(beta)</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
<LINK rel="shortcut icon" href="/favicon.ico" type="image/x-icon">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="/j/jquery.cookie.js"></script>
<script src="/j/jquery.json-2.2.min.js"></script>
<script>
$(function(){
	//$("#err").click(mklogin);
	mklogin();
});
function mklogin(){
	var k = Math.random()*999999999;
	var l = "Гость "+parseInt(k);
	var p = parseInt(Math.random()*999999999);
	$.ajax({
		type: "POST",
		url: "/reg.pl",
		success: function(data){
				if(data.error){
					$("#err").html(data.error+": "+data.text);
					if(data.error==101 || data.error==100){
						mklogin();
					}else{
						top.location="/c.html?"+Math.random();
					}
				}else{
					$("#err").html("вход");
					$.cookie("reload",$.toJSON({"l":l,"p":p}));
					top.location="/c.html?"+Math.random();
				}
			},
		error: function(jqXHR, textStatus, errorThrown){
				$("#err").html("Ошибка: "+ textStatus + " ( " + errorThrown + " )");
				top.location="/c.html?"+Math.random();
			},
		data: {
			login: l,
			pass: p,
			tmp: 1
		}
	});
}
</script>
</head>
<body>
	<h1 id="err">регистрация</h1>
</body>
</html>
